<?php
use WDB\GTO\Parser, Nette\Diagnostics\Debugger;

require '../nette.min.php';
Debugger::enable();
Debugger::$strictMode = TRUE;
require '../loader.php';

$p = new Parser(new WDB\GTO\WsqlLanguage());
//var_dump($p->parse("DELETE FROM hovno WHERE `kecup`='a'"));
$d="DELETE FROM hovno WHERE `kecup`=FUNC('a', x+5) AND COUNT()=4 AND (x!=NULL OR x=c+4*5) ORDER BY id DESC LIMIT 6";
$s="SELECT DISTINCT *, 'b'+4+5*8 AS B FROM hovno WHERE `kecup`='a' GROUP BY a HAVING a=5 ORDER BY id DESC LIMIT 5, 6";
$sj="SELECT (select 1 FROM dual) FROM hovno NATURAL LEFT JOIN kecup ON a=b+3 RIGHT JOIN fuujkecup USING majoneza";
$i1="INSERT INTO x.foo (x,y,z)VALUES('a','b','c') ON DUPLICATE KEY UPDATE x = 'f'";
$i2="REPLACE INTO x.foo SET x=a,y='b',z='cs'";
$u = "UPDATE bar SET bagr=a, x='b' WHERE a > b ORDER BY id DESC LIMIT 6";
echo $p->parse($s)->debug(TRUE)."<br>\n";
echo $p->parse($sj)->debug(TRUE)."<br>\n";
echo $p->parse($i1)->debug(TRUE)."<br>\n";
echo $p->parse($i2)->debug(TRUE)."<br>\n";
echo $p->parse($u)->debug(TRUE)."<br>\n";
echo $p->parse($d)->debug(TRUE)."<br>\n";
//Debugger::timer('parse');
//$p->debug("DELETE FROM hovno WHERE `kecup`='a'");
//echo 'Parse time: '.Debugger::timer('parse').'<br>';